package org.practice.action;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.practice.dao.CategoryDao;
import org.practice.dao.DaoFactory;
import org.practice.model.Category;

public class CategoryAction extends Action{

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		CategoryDao dao=DaoFactory.createCategoryDao();
		Category category=dao.findCategoryById(Category.BOOK_ID);
		request.setAttribute("cat1", category);		
//		response.setContentType("text/html");
//		PrintWriter out = response.getWriter();
//		out.println("<h1>dangdang</h1>");
		return mapping.findForward("success");
	}
	
}
